package com.mapper.ydq;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bean.hht.Stainfo;
import com.bean.ydq.StuInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Mapper
public interface StuStateMapper extends BaseMapper<StuInfo> {
    @Select("SELECT * FROM stuinfo s where s.interviewerId = #{interviewerId} and s.state=#{state} order by s.groups ASC ")
    public List<StuInfo> getState(@Param("interviewerId") Integer interviewerId,@Param("state") String state);

    @Select("SELECT * FROM stuinfo s where s.interviewerId = #{interviewerId} and s.state=#{state} ")
    public List<StuInfo> gettobeInterviewed(@Param("interviewerId") Integer interviewerId,@Param("state") String state);

    @Select("SELECT * FROM stuinfo s where s.interviewerId = #{interviewerId} and s.state=#{state} ")
    public List<StuInfo> getPass(@Param("interviewerId") Integer interviewerId,@Param("state") String state);

    @Select("SELECT * FROM stuinfo s where s.interviewerId = #{interviewerId} and s.state=#{state} ")
    public List<StuInfo> getFailed(@Param("interviewerId") Integer interviewerId,@Param("state") String state);

    @Select("SELECT * FROM stuinfo  where interviewerId = #{interviewerId}  order by stuinfo.groups ASC")
    public List<StuInfo> getAll(@Param("interviewerId") Integer interviewerId);

    @Select("SELECT * FROM stuinfo where stuinfo.state=#{state} order by stuinfo.groups ASC")
    public List<StuInfo> getAllStu(@Param("state")String state);
    @Update("UPDATE stuinfo  set groups = #{groups},intjob= #{intjob} where id = #{stuid}")
    public void updateStu(@Param(value="stuid")Integer stuId, @Param(value="groups")String groups, @Param(value="intjob")String intJob);

    @Select("SELECT tel FROM stuinfo s where s.id=#{id}")
    public String getTel(Integer id);

    @Select("SELECT tel FROM stuinfo s where s.id=#{id} and s.state=#{state}")
    public String getTelonCondition(Integer id,String state);

    @Select("select * from stainfo s where s.wxid = #{wxid}")
    public Stainfo showInfo (@Param(value = "wxid") String wxid);


}